/**
 * 
 */
package com.effectivsocial.controller.exceptionresolver;

import javax.inject.Named;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import lombok.extern.slf4j.Slf4j;

import org.springframework.core.Ordered;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author Dhrubo
 *
 */
@Named
@Slf4j
public class DefaultHandlerExceptionResolver implements
		HandlerExceptionResolver, Ordered {

	/* (non-Javadoc)
	 * @see org.springframework.core.Ordered#getOrder()
	 */
	public int getOrder() {
		return Integer.MIN_VALUE; // first exception resolver
	}

	/* (non-Javadoc)
	 * @see org.springframework.web.servlet.HandlerExceptionResolver#resolveException(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.Object, java.lang.Exception)
	 */
	public ModelAndView resolveException(HttpServletRequest request,
			HttpServletResponse response, Object handler, Exception exception) {
		
		log.error("Error - {}", exception);
		log.info("Handler = {}" , handler);
		log.info("Exception  - {}" , exception);
		log.info("Path info  - {}" , request.getPathInfo());
		
		
		return null;
	}

}
